<template>
  <div>
    <div class="spanSty">
      <span>国家基本公共卫生服务项目新生儿家庭访视记录表</span>
    </div>
    <el-form :model="form" label-width="140px" label-position="left"  ref="formRef" :rules="formRules">
      <el-divider content-position="left">编号</el-divider>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="姓名" prop="name">
            <el-input v-model="form.name"></el-input>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item label="身份证号" prop="idCardNo">
            <el-input v-model="form.idCardNo"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="随访日期" prop="followupDate">
            <el-date-picker
              v-model="form.followupDate"
              type="date"
              placeholder="选择日期"
              style="width: 100%"
            >
            </el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item label="性别">
            <el-select v-model="form.gender" style="width: 100%">
              <el-option
                v-for="item in sex"
                :key="item.id"
                :label="item.name"
                :value="item.name"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="出生日期">
            <el-date-picker
              v-model="form.birthday"
              type="date"
              placeholder="选择日期"
              style="width: 100%"
            >
            </el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item label="家庭住址">
            <el-input v-model="form.address"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="父亲姓名">
            <el-input v-model="form.fatherName"></el-input>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item label="父亲职业">
            <el-input v-model="form.fatherOccupation"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="父亲联系电话">
            <el-input v-model="form.fatherNumber"></el-input>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item label="父亲身份证号码">
            <el-input v-model="form.fatherIdCardNo"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="母亲姓名">
            <el-input v-model="form.motherName"></el-input>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item label="母亲职业">
            <el-input v-model="form.motherJob"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="母亲联系电话">
            <el-input v-model="form.motherPhoneNo"></el-input>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item label="母亲身份证号码">
            <el-input v-model="form.motherIdCardNo"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="出生孕周">
            <el-input v-model="form.birthGestationalWeek" placeholder="周"></el-input>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item label="母亲妊娠期患病情况">
            <el-select v-model="form.motherIllnessDuringPregnancy" style="width: 100%">
              <el-option
                v-for="item in prevalence"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="助产机构名称">
            <el-input v-model="form.midwiferyAgencyName"></el-input>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item
            label="其他(母亲妊娠...)"
            v-if="[4].includes(form.prevalence)"
          >
            <el-input v-model="form.prevalenceConten"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="出生情况">
            <el-select
              v-model="birthSituation"
              style="width: 100%"
              multiple
              @change="seChange1"
            >
              <el-option
                v-for="item in birthStatus"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item label="新生儿窒息">
            <el-select v-model="form.neonatalAsphyxia" style="width: 100%">
              <el-option
                v-for="item in neonatalAsphyxia"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item
            label="其他(出生情况)"
            v-if="!(birthSituation.indexOf(7) == -1)"
          >
            <el-input v-model="form.birthStatusOther"></el-input>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12"> </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="Apgar评分1min">
            <el-input v-model="form.Apgar1"></el-input>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item label="Apgar评分2min">
            <el-input v-model="form.Apgar2"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="Apgar评分10min">
            <el-input v-model="form.Apgar10"></el-input>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12"> </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="畸形">
            <el-select v-model="form.malformation" style="width: 100%">
              <el-option
                v-for="item in neonatalAsphyxia"
                :key="item.id"
                :label="item.name"
                :value="item.name"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item label="(畸形)" v-if="[1].includes(form.malformation)">
            <el-input v-model="form.malformationConten"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="新生儿听力筛查">
            <el-select v-model="form.hearingScreening" style="width: 100%">
              <el-option
                v-for="item in hearingScreening"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item label="新生儿疾病筛查">
            <el-select
              v-model="diseaseScreening"
              multiple
              style="width: 100%"
              @change="seChange2"
            >
              <el-option
                v-for="item in diseaseScreening"
                :key="item.id"
                :label="item.name"
                :value="item.id"
                :disabled="item.isDisabled"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="新生儿出生体重" prop="bornHeight">
            <el-input v-model="form.bornHeight" placeholder="kg"></el-input>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item label="目前体重" prop="currentWeight">
            <el-input v-model="form.currentWeight" placeholder="kg"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="出生身长" prop="bornWeight">
            <el-input v-model="form.bornWeight" placeholder="cm"></el-input>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item label="喂养方式">
            <el-select v-model="form.FeedingMethods" style="width: 100%">
              <el-option
                v-for="item in FeedingMethods"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="吃奶量" prop="milkIntake">
            <el-input v-model="form.milkIntake" placeholder="ml/次"></el-input>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item label="吃奶次数" prop="feedingTimes">
            <el-input
              v-model="form.feedingTimes"
              placeholder="次/日"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="呕吐有无">
            <el-select v-model="form.vomiting" style="width: 100%">
              <el-option
                v-for="item in neonatalAsphyxia"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item label="大便">
            <el-select v-model="form.stool" style="width: 100%">
              <el-option
                v-for="item in shit"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="大便次数" prop="stoolTimes">
            <el-input
              v-model="form.stoolTimes"
              placeholder="次/日"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item label="体温" prop="bodyTemperature">
            <el-input v-model="form.bodyTemperature" placeholder="℃"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="心率" prop="heartRateBeats">
            <el-input v-model="form.heartRateBeats" placeholder="次/分钟"></el-input>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item label="呼吸频率" prop="respiratoryTateTimes">
            <el-input
              v-model="form.respiratoryTateTimes"
              placeholder="次/分钟"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="面色">
            <el-select v-model="form.complexion" style="width: 100%">
              <el-option
                v-for="item in complexion"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item label="其他(面色)" v-if="[3].includes(form.complexion)">
            <el-input v-model="form.frontalSuture.complexionOther"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="黄疸部位">
            <el-select
              v-model="jaundiceArea"
              multiple
              style="width: 100%"
              @change="seChange3"
            >
              <el-option
                v-for="item in Jaundice"
                :key="item.id"
                :label="item.name"
                :value="item.id"
                :disabled="item.isDisabled"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item label="前囟值" >
            <el-row>
              <el-col :lg="9" :xl="9" >

                <el-form-item  prop="frontalSuture.anteriorValue1" >
                <el-input v-model="form.frontalSuture.anteriorValue1"></el-input>
                </el-form-item>
              </el-col>
              <el-col :lg="3" :xl="3"> cm&nbsp;&nbsp;&nbsp;&nbsp;x </el-col>
              <el-col :lg="9" :xl="9">
                <el-form-item  prop="frontalSuture.anteriorValue2" >
                <el-input v-model="form.frontalSuture.anteriorValue2"></el-input>
                </el-form-item>
              </el-col>
              <el-col :lg="3" :xl="3"> cm </el-col>
            </el-row>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="前囟值">
            <el-select v-model="form.anterior" style="width: 100%">
              <el-option
                v-for="item in anterior"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item label="其他(前囟值)" v-if="[4].includes(form.anterior)">
            <el-input v-model="form.complexionOther"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="眼睛">
            <el-select v-model="form.eyes" style="width: 100%">
              <el-option
                v-for="item in eye"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item label="耳外观">
            <el-select v-model="form.earAppearance" style="width: 100%">
              <el-option
                v-for="item in eye"
                :key="item.id"
                :label="item.name"
                :value="item.name"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="鼻">
            <el-select v-model="form.nose" style="width: 100%">
              <el-option
                v-for="item in eye"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item label="口腔">
            <el-select v-model="form.oralCavity" style="width: 100%">
              <el-option
                v-for="item in eye"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="心肺听诊">
            <el-select v-model="form.cardiopulmonaryAuscultation" style="width: 100%">
              <el-option
                v-for="item in eye"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item label="腹部触诊">
            <el-select v-model="form.abdomen" style="width: 100%">
              <el-option
                v-for="item in eye"
                :key="item.id"
                :label="item.name"
                :value="item.name"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="外生殖器">
            <el-select v-model="form.externalGenitalia" style="width: 100%">
              <el-option
                v-for="item in eye"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item label="四肢活动度">
            <el-select v-model="form.limbsMobility" style="width: 100%">
              <el-option
                v-for="item in eye"
                :key="item.id"
                :label="item.name"
                :value="item.name"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="肛门">
            <el-select v-model="form.anus" style="width: 100%">
              <el-option
                v-for="item in eye"
                :key="item.id"
                :label="item.name"
                :value="item.name"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item label="胸部">
            <el-select v-model="form.chest" style="width: 100%">
              <el-option
                v-for="item in eye"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="脊柱">
            <el-select v-model="form.spine" style="width: 100%">
              <el-option
                v-for="item in eye"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item label="颈部包块">
            <el-select v-model="form.neckMass" style="width: 100%">
              <el-option
                v-for="item in neonatalAsphyxia"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="皮肤">
            <el-select v-model="form.skin" style="width: 100%">
              <el-option
                v-for="item in skin"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item label="脐带">
            <el-select v-model="form.umbilicalCord" style="width: 100%">
              <el-option
                v-for="item in umbilicalCord"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="其他(皮肤)" v-if="[4].includes(form.skin)">
            <el-input v-model="form.skinOther"></el-input>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item
            label="其他(脐带)"
            v-if="[4].includes(form.umbilicalCord)"
          >
            <el-input v-model="form.umbilicalCordOther"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="指导">
            <el-select
              v-model="guide"
              multiple
              style="width: 100%"
              @change="seChange4"
            >
              <el-option
                v-for="item in guidance"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item
            label="其他(指导)"
            v-if="!(guide.indexOf(6) == -1)"
          >
            <el-input v-model="form.guidanceOther"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-divider content-position="left">转诊</el-divider>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="转诊有无">
            <el-select v-model="form.referral.ifReferral" style="width: 100%">
              <el-option
                v-for="item in neonatalAsphyxia"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item label="原因" v-if="[1].includes(form.ifReferral)">
            <el-input v-model="form.referral.reason"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="转诊机构" v-if="[1].includes(form.ifReferral)">
            <el-input v-model="form.referral.department"></el-input>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item label="转诊科室" v-if="[1].includes(form.ifReferral)">
            <el-input v-model="form.referral.institutional"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="转诊联系人" v-if="[1].includes(form.ifReferral)">
            <el-input v-model="form.referral.contactName"></el-input>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item
            label="转诊联系方式"
            v-if="[1].includes(form.ifReferral)"
          >
            <el-input v-model="form.referral.contactPhoneNo"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="结果">
            <el-select v-model="form.referral.conclusion" style="width: 100%">
              <el-option
                v-for="item in result"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item label="下次随访日期" prop="nextFollowupDate">
            <el-date-picker
              v-model="form.nextFollowupDate"
              type="date"
              placeholder="选择日期"
              style="width: 100%"
            >
            </el-date-picker>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="下次随访地点">
            <el-input v-model="form.nextFollowupPlace"></el-input>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item label="随访医生">
            <el-input v-model="form.followDoctor"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="随访医生签名">
            <el-upload
              class="upload-demo"
              action=""
              list-type="picture-card"
              :before-remove="beforeRemove"
              :on-change="onprogress"
              accept=".jpg,.png,"
              :multiple="false"
              :limit="1"
              :on-exceed="onExceed"
              :file-list="fileList"
              :auto-upload="false"
            >
              <em class="el-icon-plus"></em>
              <div slot="tip" class="el-upload__tip">
                只能上传jpg/png文件，且不超过500kb
              </div>
            </el-upload>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12">
          <el-form-item label="居民签名">
            <el-upload
              class="upload-demo"
              action=""
              list-type="picture-card"
              :before-remove="beforeRemove1"
              :on-change="onprogress1"
              accept=".jpg,.png,"
              :multiple="false"
              :limit="1"
              :on-exceed="onExceed1"
              :file-list="fileList1"
              :auto-upload="false"
            >
              <em class="el-icon-plus"></em>
              <div slot="tip" class="el-upload__tip">
                只能上传jpg/png文件，且不超过500kb
              </div>
            </el-upload>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :lg="12" :xl="12">
          <el-form-item label="现场图片">
            <el-upload
              class="upload-demo"
              action=""
              list-type="picture-card"
              :before-remove="beforeRemove2"
              :on-change="onprogress2"
              accept=".jpg,.png,"
              :multiple="false"
              :limit="1"
              :on-exceed="onExceed2"
              :file-list="fileList2"
              :auto-upload="false"
            >
              <em class="el-icon-plus"></em>
              <div slot="tip" class="el-upload__tip">
                只能上传jpg/png文件，且不超过500kb
              </div>
            </el-upload>
          </el-form-item>
        </el-col>
        <el-col :lg="12" :xl="12"> </el-col>
      </el-row>


      <el-row type="flex" class="submitSty">
        <HButton type="add" @click="submit('formRef')">提交</HButton>
      </el-row>
    </el-form>
  </div>
</template>

<script>
import {
  sex,
  prevalence,
  birthStatus,
  neonatalAsphyxia,
  hearingScreening,
  diseaseScreening,
  FeedingMethods,
  shit,
  complexion,
  Jaundice,
  anterior,
  eye,
  skin,
  umbilicalCord,
  guidance,
  result,
  addNewBorn
} from "@/api/followForms/newborn";
import axios from 'axios'
import { IDValid, inputValidator, phoneValid } from '@/utils/validate'
export default {
  data() {
    return {
      formRules: {
        name: inputValidator,
        idCardNo: IDValid,
        bornHeight:inputValidator,
        currentWeight:inputValidator,
        bornWeight:inputValidator,
        milkIntake:inputValidator,
        feedingTimes:inputValidator,
        stoolTimes:inputValidator,
        bodyTemperature:inputValidator,
        heartRateBeats:inputValidator,
        respiratoryTateTimes:inputValidator,
        frontalSuture:{
          anteriorValue1:inputValidator,
          anteriorValue2:inputValidator
        },
        nextFollowupDate:inputValidator,
        followupDate:inputValidator
      },
      jaundiceArea:[],
      form: {
        ifReferral:1,
        frontalSuture:{
          anteriorValue1:'',
          anteriorValue2:''
        },
        referral:{},
      },
      fileList: [],
      fileList1: [],
      fileList2: [],
      birthSituation: [],
      diseaseScreening: [],
      JaundiceArr: [],
      guide: [],
      sex: sex,
      prevalence: prevalence,
      birthStatus: birthStatus,
      neonatalAsphyxia: neonatalAsphyxia,
      hearingScreening: hearingScreening,
      diseaseScreenings: diseaseScreening,
      FeedingMethods: FeedingMethods,
      shit: shit,
      complexion: complexion,
      Jaundice: Jaundice,
      anterior: anterior,
      eye: eye,
      skin: skin,
      umbilicalCord: umbilicalCord,
      guidance: guidance,
      result: result,
    };
  },
  created() {},
  methods: {
    submit(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
        addNewBorn(this.form).then(res =>{
        if(res.code="AA000000"){
          this.$message.success(res.message);
          this.form={};
        }
      })
        } else {
          return false;
        }
      });

    },
    //多选封装
    select(value, options) {
      if (!(value.indexOf(1) == -1)) {
        options.forEach((e) => {
          if (e.id != 1) {
            e.isDisabled = true;
          } else {
            e.isDisabled = false;
          }
        });
      } else if (value.length == 0) {
        options.forEach((e) => {
          e.isDisabled = false;
        });
      } else {
        options.forEach((e) => {
          if (e.id == 1) {
            e.isDisabled = true;
          } else {
            e.isDisabled = false;
          }
        });
      }
    },
    //出生情况选择
    seChange1(value) {
      this.form.birthStatus = this.birthSituation.toString();
    },
    //新生儿疾病筛查
    seChange2(value) {
      this.form.diseaseScreening = this.diseaseScreening.toString();
      this.select(value, this.diseaseScreening);
    },
    //黄疸部位选择
    seChange3(value) {
      this.form.Jaundice = this.jaundiceArea.toString();
      this.select(value, this.Jaundice);
    },
    //指导选择
    seChange4(value) {
      this.form.guidance = this.guide.toString();
    },
    beforeRemove(file, fileList) {
      return this.$confirm(`确定移除 ${file.name}？`);
    },
    onprogress(file, fileList) {
      this.fileList = fileList;
      const fileSize = file.size / 1024 < 500;
      if (!fileSize) {
        this.$message.warning("不能超过500kb！");
        this.fileList.pop();
      }
      this.uploadImage();
    },
    async uploadImage() {

      let formData = new FormData();
      if (this.fileList.length > 0) {
        this.fileList.map((item) => {
          formData.append("images", item.raw);
        });
        formData.append("token", this.$store.state.token);
        axios({
          method: "POST",
          url: this.uploadImgUrl,
          headers: {
            "Content-Type": "multipart/form-data",
            "token":this.$store.state.token,
          },
          withCredentials: false,
          data: formData,
        }).then((res) => {
          if (res.data.code == "AA000000") {
            this.form.pictures = res.data.data;

            console.log("555555555555",this.form.pictures)
          }
        });
      }

      let formData1 = new FormData();
      if (this.fileList1.length > 0) {
        this.fileList1.map((item) => {
          formData1.append("images", item.raw);
        });
        formData1.append("token", this.$store.state.token);
        await axios({
          method: "POST",
          url: this.uploadImgUrl,
          headers: {
            "Content-Type": "multipart/form-data",
            token:this.$store.state.token,
          },
          withCredentials: false,
          data: formData1,
        }).then((res1) => {
          if (res1.data.code == "AA000000") {
            this.form.residentName = res1.data.data;
          }
        });
      }









      let formData2 = new FormData();
      if (this.fileList2.length > 0) {
        this.fileList2.map((item) => {
          formData2.append("images", item.raw);
        });
        formData2.append("token", this.$store.state.token);
        await axios({
          method: "POST",
          url: this.uploadImgUrl,
          headers: {
            "Content-Type": "multipart/form-data",
            token:this.$store.state.token,
          },
          withCredentials: false,
          data: formData2,
        }).then((res2) => {
          if (res1.data.code == "AA000000") {
            this.form.sceneName = res2.data.data;
          }
        });
      }



    },
    onExceed() {
      this.$message.error("最多上传1个！");
    },
    beforeRemove1(file, fileList) {
      return this.$confirm(`确定移除 ${file.name}？`);
    },
    onprogress1(file, fileList) {
      this.fileList1 = fileList;
      const fileSize = file.size / 1024 < 500;
      if (!fileSize) {
        this.$message.warning("不能超过500kb！");
        this.fileList.pop();
      }
    },
    onExceed1() {
      this.$message.error("最多上传1个！");
    },
    beforeRemove2(file, fileList) {
      return this.$confirm(`确定移除 ${file.name}？`);
    },
    onprogress2(file, fileList) {
      this.fileList2 = fileList;
      const fileSize = file.size / 1024 < 500;
      if (!fileSize) {
        this.$message.warning("不能超过500kb！");
        this.fileList.pop();
      }
    },
    onExceed2() {
      this.$message.error("最多上传1个！");
    },
  },
};
</script>

<style lang="less" scoped>
.spanSty {
  font-size: 30px;
  width: 900px;
  margin-bottom: 20px;
  margin-left: 30%;
}
.submitSty {
  float: right;
  margin-right: 45%;
}
</style>
